package com.wtcrazy.service.Impl;

import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.wtcrazy.dao.OrderMapper;
import com.wtcrazy.entity.Order;
import com.wtcrazy.service.IOrderService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.Date;
import java.util.List;
import java.util.UUID;

@Service
public class OrderServiceImpl extends ServiceImpl<OrderMapper, Order> implements IOrderService {
    @Autowired
    OrderMapper orderMapper;

    @Override
    public Order userSubmit(Order order) {
        order.setId(UUID.randomUUID().toString().replace("-", ""));
        order.setTime(new Date().getTime());
        orderMapper.userSubmit(order);
        return order;
    }

    @Override
    public List<Order> userGetAll(String uid) {
        return orderMapper.userGetAll(uid);
    }

    @Override
    public Order userGet(String id) {
        return orderMapper.userGet(id);
    }
}
